import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/film',
    component: () => import('../views/Film.vue'),
    children:[
      {
        path: 'hotplaying',
        component: () => import('../views/film/HotPlaying.vue'),
      },
      {
        path: 'willplaying',
        component: () => import('../views/film/WillPlaying.vue'),
      }
    ]
  },
  {
    path: '/cinema',
    component: () => import('../views/Cinema.vue')
  },
  {
    path: '/zixun',
    component: () => import('../views/Zixun.vue')
  },
  {
    path: '/mine',
    component: () => import('../views/Mine.vue')
  },
  {
    path: '/detail/:id',
    component: () => import('../views/Detail.vue')
  },
  {
    path: '*',
    redirect:'/film/hotplaying'
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
